<?php
/***************************************************************
*  Copyright notice
*
*  (c) 2009 Christian Kartnig <office@hahnepeter.de>
*  All rights reserved
*
*  This script is part of the TYPO3 project. The TYPO3 project is
*  free software; you can redistribute it and/or modify
*  it under the terms of the GNU General Public License as published by
*  the Free Software Foundation; either version 2 of the License, or
*  (at your option) any later version.
*
*  The GNU General Public License can be found at
*  http://www.gnu.org/copyleft/gpl.html.
*
*  This script is distributed in the hope that it will be useful,
*  but WITHOUT ANY WARRANTY; without even the implied warranty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*  GNU General Public License for more details.
*
*  This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
 * [CLASS/FUNCTION INDEX of SCRIPT]
 *
 * Hint: use extdeveval to insert/update function index above.
 */

require_once(t3lib_extMgm::extPath('topstip').'lib/class.topstip_pibase.php');

/**
 * @author	Christian <office@hahnepeter.de>
 * @package	TYPO3
 * @subpackage	tx_test
 */
class tx_topstip_pi3 extends topstip_pibase {
	var $prefixId      = 'tx_topstip_pi3';		// Same as class name
	var $scriptRelPath = 'pi3/class.tx_topstip_pi3.php';	// Path to this script relative to the extension dir.
	var $extKey        = 'topstip';	// The extension key.
	var $pi_checkCHash = true;

	
	/**
	 * The main method of the PlugIn
	 *
	 * @param	string		$content: The PlugIn content
	 * @param	array		$conf: The PlugIn configuration
	 * @return	The content that is displayed on the website
	 */
	
	function main($content, $conf) {
		
		$this->conf = $conf;
		$this->pi_setPiVarDefaults();
		//$this->pi_loadLL();
		$this->pi_initPIflexForm();
		
		if(!$this->tsfe->fe_user->user['uid']) {
			return "Sie müssen eingeloggt sein um Ihre Anträge einsehen zu können.";
		}
		//$this->dbTable = $this->getPluginParam('dbTable');

		$this->oForm = t3lib_div::makeInstance("tx_ameosformidable");
		$this->oForm->init(
			$this,	// reference to the current plugin object
			"EXT:topstip/pi3/xml/requestlist.xml" // soft-path to xml file
		);

		return $this->pi_wrapInBaseClass($this->oForm->render());
	}

	public function getListSql(){
		$fields = "t.crdate,
					tx_kbks_vorname,
					tx_kbks_nachname,
					tx_kbks_svnr,
					tx_kbks_fe_user
					";
		$where = "	t.deleted=0 AND
					TRIM(tx_kbks_fe_user) = '".$this->tsfe->fe_user->user['uid']."'";

		
		$query = $this->getQuery($fields, $where);
		return $query;
	}
	
	
}

if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/topstip/pi3/class.tx_test_pi3.php'])	{
	include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/topstip/pi3/class.tx_test_pi3.php']);
}

?>
